package com.xiaozhen.data.consumer;

import com.alibaba.fastjson.JSONObject;
import com.xiaozhen.alarm.handler.AlarmHandler;
import com.xiaozhen.data.service.ProcessingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Consumer;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/10/28 14:01
 * @description:
 */
@Configuration
public class CommonConsumer {

    @Autowired
    private ProcessingService processingService;

    @Bean
    public Consumer<JSONObject> customJson() {
        return jsonData -> {
            processingService.saveJsonData(jsonData);
        };
    }
}
